package Thread_.homework;

class Mythread01 extends Thread{
    @Override
    public void run() {
        while(true){
            System.out.println("Thread1 run");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class test1 {
    public static void main(String[] args) throws InterruptedException {
        //1.通过继承Thread类创建线程
        Mythread01 t1 = new Mythread01();
        t1.start();
        while(true){
            System.out.println("main ");
            Thread.sleep(1000);
        }
    }
}
